package cn.iocoder.yudao.module.shop.dal.mysql.memberpay;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.memberpay.ShopMemberPayDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.memberpay.vo.*;

/**
 * 每支价格 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopMemberPayMapper extends BaseMapperX<ShopMemberPayDO> {

    default PageResult<ShopMemberPayDO> selectPage(ShopMemberPayPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopMemberPayDO>()
                .likeIfPresent(ShopMemberPayDO::getName, reqVO.getName())
                .eqIfPresent(ShopMemberPayDO::getPrice, reqVO.getPrice())
                .eqIfPresent(ShopMemberPayDO::getUserLevel, reqVO.getUserLevel())
                .betweenIfPresent(ShopMemberPayDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopMemberPayDO::getId));
    }

    default List<ShopMemberPayDO> selectList(ShopMemberPayExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopMemberPayDO>()
                .likeIfPresent(ShopMemberPayDO::getName, reqVO.getName())
                .eqIfPresent(ShopMemberPayDO::getPrice, reqVO.getPrice())
                .eqIfPresent(ShopMemberPayDO::getUserLevel, reqVO.getUserLevel())
                .betweenIfPresent(ShopMemberPayDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopMemberPayDO::getId));
    }

}
